<script lang="ts" setup>
import {
  Check,
  Delete,
} from '@element-plus/icons-vue'

import { reactive } from 'vue'

const formInline = reactive({
  user: 'asdasd',
  region: '',
  date: '',
})

const onSubmit = () => {
  console.log('submit!')
}


const tableData = [
    {  id:'1',
        user:'ww',
        pw:'123456',
        name: '小林',
        sex: '男',
        number:'1232132'
    },
    {   id:'2',
        user:'ss',
        pw:'123456',
        name: '张四',
        sex: '男',
        number:'343243422'
    }
    ,{   id:'3',
        user:'dsw',
        pw:'123456',
        name: '小林',
        sex: '男',
        number:'1324232132'
    }
    ,{   id:'4',
        user:'wasdw',
        pw:'123456',
        name: '小林',
        sex: '男',
        number:'154232132'
    }
    
]
function ons(){
    formInline.user = '';
}
</script>

<template>

   <el-card>
      <div class="card-header">
        <span> 宿舍管理</span>
        <el-button  type="primary" @click="ons">添加</el-button>
      </div>

      <div style="margin-top: 20px;">
        <hr>
    </div>

  

      <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <el-form-item label="姓名">
      <el-input v-model="formInline.user" placeholder="请输入姓名" clearable />
    </el-form-item>

    <el-form-item>
      <el-button class="osp" type="primary" @click="onSubmit">搜索</el-button>
    </el-form-item>
 
  </el-form>

  <el-scrollbar height="580px">

    <el-table :data="tableData" height="400"  style="width: 100%">
      <el-table-column prop="id" label="id" />
      <el-table-column prop="user" label="用户名" />
        <el-table-column prop="pw" label="密码" />
        <el-table-column prop="name" label="姓名" />
        <el-table-column prop="sex" label="性别" />
        <el-table-column prop="number" label="电话" />
       
        <el-table-column label="操作" width="180">
            <div>
                <el-button type="success" :icon="Check" circle />
                <el-button type="danger" :icon="Delete" circle />
            </div>
        </el-table-column>

        
    </el-table>
</el-scrollbar>
    
    </el-card>


</template>

<style setup>


.card-header{
    display: flex;
    justify-content: space-between;
}

.scrollbar-demo-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  margin: 10px;
  text-align: center;
  border-radius: 4px;
  background: var(--el-color-primary-light-9);
  color: var(--el-color-primary);
}


</style>